<!-- saved from url=(0014)about:internet --><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<html>
<!-- Standard Head Part -->
<head>
<title>NUnit - ParameterizedTests</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta http-equiv="Content-Language" content="en-US">
<link rel="stylesheet" type="text/css" href="nunit.css">
<link rel="shortcut icon" href="favicon.ico">
</head>
<!-- End Standard Head Part -->

<body>

<!-- Standard Header for NUnit.org -->
<div id="header">
  <a id="logo" href="http://www.nunit.org"><img src="img/logo.gif" alt="NUnit.org" title="NUnit.org"></a>
  <div id="nav">
    <a href="http://www.nunit.org">NUnit</a>
    <a class="active" href="index.html">Documentation</a>
  </div>
</div>
<!-- End of Header -->

<div id="content">

<h2>Parameterized Tests</h2>

<p>NUnit 2.5 supports parameterized tests. Test methods
may have parameters and various attributes are available
to indicate what arguments should be supplied by NUnit.

<p>Multiple sets of arguments cause the creation of multiple
tests. All arguments are created at the point of loading the
tests, so the individual test cases are available for 
display and selection in the Gui, if desired.

<p>Some attributes allow you to specify arguments inline - directly on
   the attribute - while others use a separate method, property or field
   to hold the arguments. In addition, some attributes identify complete test cases,
   including all the necessary arguments, while others only provide data
   for a single argument. This gives rise to four groups of attributes,
   as shown in the following table.
   
<table class="nunit">
<tr><th></th><th>Complete Test Cases</th><th>Data for One Argument</th></tr>
<tr><th>Inline</th>
    <td><a href="testCase.html">TestCaseAttribute</a></td>
    <td><a href="random.html">RandomAttribute</a><br>
	    <a href="range.html">RangeAttribute</a><br>
		<a href="values.html">ValuesAttribute</a></td></tr>
<tr><th>Separate</th>
	<td><a href="testCaseSource.html">TestCaseSourceAttribute</a></td>
	<td><a href="valueSource.html">ValueSourceAttribute</a></td></tr>
</table>

<p>In addition, when data is specified for individual arguments, special attributes
may be added to the test method itself in order to tell NUnit how
to go about combining the arguments. Currently, the following attributes
are provided:

<ul>
<li><a href="combinatorial.html">CombinatorialAttribute</a> (default)
<li><a href="pairwise.html">PairwiseAttribute</a><li><a href="sequential.html">SequentialAttribute</a></ul>

<h3>Order of Execution</h3>

<p>In NUnit 2.5, individual test cases are sorted alphabetically and executed in
   that order. With NUnit 2.5.1, the individual cases are not sorted, but are
   executed in the order in which NUnit discovers them. This order does <b>not</b>
   follow the lexical order of the attributes and will often vary between different
   compilers or different versions of the CLR.
   
<p>The following specific rules for ordering apply:
<ol>
<li>If all arguments are specified in a <b>single TestCaseSource</b> attribute,
    the ordering of the cases provided will be maintained.
<li>If each parameter has a <b>single Values</b>, <b>ValueSource</b> or
    <b>Range</b> attribute and the <b>Sequential</b> combining strategy
	is used - or there is only one argument - the ordering will be maintained.
<li>In all other cases, including using multiple <b>TestCase</b> attributes
    or a combination of different types of attributes, the ordering of the
	test cases is undefined.
</ol>   

</div>

<!-- Submenu -->
<div id="subnav">
<ul>
<li><a href="index.html">NUnit 2.5.9</a></li>
<ul>
<li><a href="getStarted.html">Getting&nbsp;Started</a></li>
<li><a href="assertions.html">Assertions</a></li>
<li><a href="constraintModel.html">Constraints</a></li>
<li><a href="attributes.html">Attributes</a></li>
<ul>
<li><a href="category.html">Category</a></li>
<li><a href="combinatorial.html">Combinatorial</a></li>
<li><a href="culture.html">Culture</a></li>
<li><a href="datapoint.html">Datapoint(s)</a></li>
<li><a href="description.html">Description</a></li>
<li><a href="exception.html">Exception</a></li>
<li><a href="explicit.html">Explicit</a></li>
<li><a href="ignore.html">Ignore</a></li>
<li><a href="maxtime.html">Maxtime</a></li>
<li><a href="pairwise.html">Pairwise</a></li>
<li><a href="platform.html">Platform</a></li>
<li><a href="property.html">Property</a></li>
<li><a href="random.html">Random</a></li>
<li><a href="range.html">Range</a></li>
<li><a href="repeat.html">Repeat</a></li>
<li><a href="requiredAddin.html">RequiredAddin</a></li>
<li><a href="requiresMTA.html">Requires&nbsp;MTA</a></li>
<li><a href="requiresSTA.html">Requires&nbsp;STA</a></li>
<li><a href="requiresThread.html">Requires&nbsp;Thread</a></li>
<li><a href="sequential.html">Sequential</a></li>
<li><a href="setCulture.html">SetCulture</a></li>
<li><a href="setup.html">Setup</a></li>
<li><a href="setupFixture.html">SetupFixture</a></li>
<li><a href="suite.html">Suite</a></li>
<li><a href="teardown.html">Teardown</a></li>
<li><a href="test.html">Test</a></li>
<ul>
<li id="current"><a href="parameterizedTests.html">Parameterized&nbsp;Tests</a></li>
</ul>
<li><a href="testCase.html">TestCase</a></li>
<li><a href="testCaseSource.html">TestCaseSource</a></li>
<li><a href="testFixture.html">TestFixture</a></li>
<li><a href="fixtureSetup.html">TestFixtureSetUp</a></li>
<li><a href="fixtureTeardown.html">TestFixtureTearDown</a></li>
<li><a href="theory.html">Theory</a></li>
<li><a href="timeout.html">Timeout</a></li>
<li><a href="values.html">Values</a></li>
<li><a href="valueSource.html">ValueSource</a></li>
</ul>
<li><a href="runningTests.html">Running&nbsp;Tests</a></li>
<li><a href="extensibility.html">Extensibility</a></li>
<li><a href="releaseNotes.html">Release&nbsp;Notes</a></li>
<li><a href="samples.html">Samples</a></li>
<li><a href="license.html">License</a></li>
</ul>
</ul>
</div>
<!-- End of Submenu -->


<!-- Standard Footer for NUnit.org -->
<div id="footer">
  Copyright &copy; 2010 Charlie Poole. All Rights Reserved.
</div>
<!-- End of Footer -->

</body>
</html>
